/* Magician Job Instructor
	Magician 2nd Job Advancement
	Victoria Road : The Forest North of Ellinia (101020000)
*/

void npc(Player @player, NPC @npc) {
	int state = npc.getState();
	if(state == 0){
		if(player.getJob() == 200){
			if(player.getLevel() >= 30){
				if(player.getItemAmount(4031012) == 0){
					if(player.getItemAmount(4031009) > 0){
						npc.addText("I see, so Grendel the Really Old wishes for me to test you. Well then, are you ready to begin the test?");
						state = 1;
						npc.sendYesNo();
					}
					else{
						npc.addText("You can't take the test without a recommendation.");
						npc.sendOK();
						npc.end();
					}
				}
				else{
					npc.addText("What are you waiting for? Take that medal to Grendel the Really Old.");
					npc.sendOK();
					npc.end();
				}
			}
			else{
				npc.addText("You are too weak to advance. Come back when you are at least level 30.");
				npc.sendOK();
				npc.end();
			}
		}
		else{
			npc.addText("Hello traveler.");
			npc.sendOK();
			npc.end();
		}
	}
	else if(state == 1){
		if(npc.getSelected() == YES){
			npc.addText("Very well. Let the test commence.");
			npc.sendOK();
			player.giveItem(4031009, -1);
			player.changeMap(108000200);
			npc.end();
		}
		else{
			npc.addText("I see. Come back when you are ready to take the test.");
			npc.sendOK();
			npc.end();
		}
	}
}